//
//  ActivityEditingViewController.h
//  TimeTracker
//
//  Created by Michael Flakus on 2/21/13.
//  Copyright (c) 2013 Michael Flakus. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <sqlite3.h>

@protocol PropertyEditing
- (void)setValue:(id)newValue forEditedProperty:(NSString *)field;
@end


@interface ActivityEditingViewController : UIViewController <UIPickerViewDelegate> {
	
	UITextField *activityNameTextField;
    UITextField *createCategoryTextField;
    UIPickerView *categoryPicker;
    
    id editedObject;
    NSString *editedPropertyKey;
    NSString *editedPropertyDisplayName;
	
    BOOL editingCategory;
	
    NSString *activityID;
    NSString *activityName;
    NSString *categoryName;
    NSString *selectedCategoryID;
    
	id <PropertyEditing> sourceController;
}

@property (nonatomic, retain) IBOutlet UITextField *activityNameTextField;
@property (nonatomic, retain) IBOutlet UITextField *createCategoryTextField;
@property (nonatomic, retain) IBOutlet UIPickerView *categoryPickerView;

/*
 Aspects of the object being edited:
 The object itself, the name of the property being edited, and the name to display to the user.
 */
@property (nonatomic, retain) id editedObject;
@property (nonatomic, retain) NSString *editedPropertyKey;
@property (nonatomic, retain) NSString *editedPropertyDisplayName;


@property (nonatomic, retain) NSString *activityID;
@property (nonatomic, retain) NSString *activityName;
@property (nonatomic, retain) NSString *categoryName;
@property (nonatomic, retain) NSString *selectedCategoryID;


// database variables
@property (nonatomic) sqlite3 *database;
@property (strong, nonatomic) NSString *databasePath;
@property (nonatomic, strong) NSMutableArray *categoryIds;
@property (nonatomic, strong) NSMutableArray *categoryNames;


@property (nonatomic, retain) id <PropertyEditing>  sourceController;

- (IBAction)cancel;
- (IBAction)save;

@end

